import java.sql.*;


public class DatabaseConnector 
{

  public static void main (String args[])
  {
    try
    {
      Connection conn = null;

      // Loads the class object for the mysql driver into the DriverManager.
      Class.forName("com.mysql.jdbc.Driver");
      
      // Attempt to establish a connection to the specified database via the
      // DriverManager
      conn = DriverManager.getConnection("jdbc:mysql://comtor.org/" +
        "javafoundations?user=jf2e&password=hirsch");

      if (conn != null)
      {
        System.out.println("We have connected to our database!");
        conn.close();
      }
      
    } catch (SQLException ex) {
      System.out.println("SQLException: " + ex.getMessage());
      ex.printStackTrace();
    } catch (Exception ex) {
      System.out.println("Exception: " + ex.getMessage());
      ex.printStackTrace();
    }
  }
}